package com.df.springmvc.system.log.controller;

import java.util.ArrayList;
import java.util.HashMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.common.bean.DhtmlGridBean;
import com.df.springmvc.common.bean.MsgBean;
import com.df.springmvc.common.util.WebUtil;
import com.df.springmvc.supper.SupperController;
import com.df.springmvc.system.log.services.LogServices;

@Controller
@RequestMapping("/system/log/Log")
/**
 * 本类仅做一些简单数据处理如:
 *格式验证
 *数据封装
 * @author David
 *
 */
public class LogController extends SupperController{
	String page_org="system/log/" + this.getClass().getSimpleName().replace("Controller","") + "_";
	@Autowired
	LogServices services;
	@Autowired
	MessageSource messageSource;
	
	public LogController(){
		// TODO Auto-generated constructor stub
		//
	}
	@RequestMapping(value={"/"})
	public String excute(ModelMap model,HttpServletRequest request,HttpServletResponse response){
		org.apache.log4j.Logger.getLogger(getClass()).info("2222");
		return page_org;
	}
	@RequestMapping(value={"/query"})
	public void query(ModelMap model,HttpServletRequest request,HttpServletResponse response){
		try{
			DhtmlGridBean gridBean=services.query(getParam_PagingBean(request),getParamMap(request,"map"));
			WebUtil.json(response,new MsgBean(gridBean));
		}catch(Exception e){
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@RequestMapping(value={"/" + toAdd})
	public String toAdd(ModelMap model,HttpServletRequest request,HttpServletResponse response){
		try{
		}catch(Exception e){
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return page_org + Add;
	}

}
